import React, {Component, Fragment} from 'react'

class MyCom2 extends Component {
  constructor(props) {
    super(props)
    this.state = {
      username: '',
      password: ''
    }
  }

  render() {
    return(
      <Fragment>
        <div>
          <label>用户名：</label>
          <input value={this.state.username} onChange={this.handleUsername.bind(this)} />
          <label>密码：</label>
          <input value={this.state.password} onChange={this.handlePassword.bind(this)} type='password'/>
          <button onClick={this.login.bind(this)}>点击登录</button>
        </div>
      </Fragment>
    )
  }

  handleUsername(e) {
    const username = e.target.value
    this.setState({
      username:username
    })
  }

  handlePassword(e) {
    const password = e.target.value
    this.setState({
      password:password
    })
  }

  login() {
    
  }
}

export default MyCom2